const gulp = require('gulp');
const shell = require('gulp-shell');
// const colors = require('colors');

gulp.task('test:ts', shell.task(`npm run test:ts`));

gulp.task('test:server', shell.task(`feidao-server`));

gulp.task('test', gulp.parallel('test:ts', 'test:server'));

gulp.task('build:minify', () => {
	const uglify = require('gulp-uglify-es').default;

	return gulp.src('dist/**/*.js')
		.pipe(uglify({
			compress: {
				comments: true,
				drop_console: true
			}
		}))
		.pipe(gulp.dest(`dist/`));
});

gulp.task('default', gulp.series('build:minify'));

gulp.task('check:client', (cb) => {
	// todo
	cb();
});

gulp.task('check:service', (cb) => {
	// todo
	cb();
});

gulp.task('check:widgets', (cb) => {
	// todo
	cb();
});

gulp.task('check:send-msg', (cb) => {
	// todo
	cb();
});

gulp.task('check', gulp.parallel('check:client', 'check:service', 'check:widgets', 'check:send-msg'));
